import { Router } from 'express';
import { 
  getAdminUsers, 
  createAdminUser, 
  updateAdminUser, 
  deleteAdminUser,
  getAdminUserById,
  getUserStats,
  checkUsernameAvailability,
  checkEmailAvailability
} from '../controllers/adminUserController';
import { authenticate, authorize } from '../middleware/auth';

const router = Router();

// 用户管理路由
router.get('/', authenticate, authorize(['admin','editor']), getAdminUsers);
router.get('/stats', authenticate, authorize(['admin']), getUserStats);
router.get('/check-username', authenticate, authorize(['admin']), checkUsernameAvailability);
router.get('/check-email', authenticate, authorize(['admin']), checkEmailAvailability);
router.get('/:id', authenticate, authorize(['admin','editor']), getAdminUserById);
router.post('/', authenticate, authorize(['admin']), createAdminUser);
router.put('/:id', authenticate, authorize(['admin']), updateAdminUser);
router.delete('/:id', authenticate, authorize(['admin']), deleteAdminUser);

export default router; 